<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/include.inc.jsp" %>
<!DOCTYPE html>
<html>
<head>
    <%@include file="/WEB-INF/views/layout/miiteen/v1/base.ref.jsp" %>
    <%@include file="/WEB-INF/views/layout/miiteen/v1/page.edit.ref.jsp" %>
</head>
<body>
<div class="mainpage edit">

    <!--顶部操作工具栏-->
    <mt-toolbar>
        <shiro:hasPermission name="singleInfo:edit">
            <mt-button label="保存" type="primary" icon="el-icon-check" @click="save"></mt-button>
        </shiro:hasPermission>
        <mt-button label="返回" icon="el-icon-back" @click="back"></mt-button>
    </mt-toolbar>

    <!--编辑表单-->
    <mt-edit-content>
        <mt-form :ref="formid" :col="3" :model="form" :rules="rules" :label-width="labelwidth">
            <!--视业务进行更改-begin-->
            <mt-form-item label="单选" prop="accountName">
                <el-input v-model="form.accountName" placeholder="单选" @focus="selectAccount" :readonly="true"></el-input>
            </mt-form-item>
            <mt-form-item label="多选" prop="roleName">
                <el-input v-model="form.roleName" placeholder="多选" @focus="sysRole" :readonly="true"></el-input>
            </mt-form-item>
            <!--视业务进行更改-end-->
        </mt-form>
    </mt-edit-content>
</div>
<script>
    //初始化数据，必须放置在列表页面封装部分前
    function initVueOption(obj) {
        //设置控制器
        obj.data.controller = "${ctx}/customsportal/popup";
        //设置表单数据
        obj.data.form = ${popup};

        //单选
        obj.methods.selectAccount = function () {
            miiteen.customsearch.open("selectPopupDemo", function (result) {

                var role = result[0];
                Page.form.accountId = role.result1;
                Page.form.accountName = role.result2;
            }, {
                title: "",
                type: "list",
                multiple: false
            })
        }

        //多选
        obj.methods.sysRole = function () {
            miiteen.customsearch.open("selectPopupDemo", function (result) {
                if(result!=null&& result.length>0){
                    Page.form.roleId="";
                    Page.form.roleName="";
                    for(var i=0;i<result.length;i++){
                        Page.form.roleId += result[i].result1+",";
                        Page.form.roleName += result[i].result2+",";
                    }
                    Page.form.roleId = Page.form.roleId.substr(0,Page.form.roleId.length-1) ;
                    Page.form.roleName = Page.form.roleName .substr(0,Page.form.roleName.length-1);

                }

            },{
                title: "",
                type: "list",
                multiple: true
            })
        }
    }
</script>
</body>
</html>
